-----------------
About gi.exe
-----------------
	gi.exe provides gi command's functions + alpha.
	The result of execution is saved in [the folder gi.exe exists]\gi.txt.

	If you change the file name of gi.exe to the name of which the
	beginning letter is "A", the part of display will be reversed instead
	 of the popup display.
	(Use this when you would like not to show the message box with
	AutoRun.exe. etc.)
	Other than above, if the command line parameter of gi.exe includes "/",
	the destination of output will be not the file output but the standard
	debug output.

	In the case of the file output, if there is gi.txt, the result data will
	be added at the end of file data.

	+alpha functions		
	the display of time		GetLocalTime
	the state of the work memory	GlobalMemoryStatus
	the state of the disk		GetDiskFreeSpaceEx
	the state of window		GetWindow, etc.

	*  The function of GetDbgInf.exe has been added.
		The result is saved in GetDbgInf.txt.
		Other behavior is same as gi.txt.

-----------------
General description of gi.txt
-----------------

File configuration
@**************************** 2001/02/14 11:22:33 ******************************
A-------- MemoryStatus -----------
B-------- DiskFreeSpace ----------
C-------- Process ----------------- ProcID   AKY      BaseAddr
D-------- Thread -- State  ThrdID   CurProc  AKY      Cp Bp   CPU Time
E-------- Module ------------------ hModule  InUSE    BaseAddr
F----------- Window --------------- hWnd     STYLE    EXSTYLE  ThrdID   ProcID

1.The display of time
2.The state of the work memory
3.The state of the disk
4.Process
5.Thread
6.Module
7.Window


-----------------
Detailed description of gi.txt
-----------------
1.The display of time
	The date and time when gi.exe is executed by GetLocalTime.

2.The state of the work memory
	The value got by GlobalMemoryStatus

	MemoryLoad	The ratio(%) of using work memory [ (1 - AvailPhys /
			TotalPhys) * 100 ]
	TotalPhys	The total physical work memory
	AvailPhys	The available work memory
	TotalPageFile	0
	AvailPageFile	0
	TotalVirtual	The total virtual memory of gi.exe
	AvailVirtual	The available virtual memory of gi.exe


3.The state of the disk
	The value got by GetDiskFreeSpaceEx
	The result of GetDiskFreeSpaceEx of both root and folders in root.


	--- \ ---			Main
	--- \Multimedia Card\ ---	Multimedia card
	--- \?????\ ---			each folder

	FreeBytesAvailableToCaller	The available disk size for gi.exe
	TotalNumberOfBytes		The total disk size
	TotalNumberOfFreeBytes		The available disk size


4.Process
5.Thread
	The process and the thread created by the process

	The line where the file name is shown means the information of process.
	The line where the file name is not shown means the information of
	thread.

	The information of the threads created by the process are located below
	the information of the process.

	The following example indicates that the thread of which thread ID is
	01fff1be, which is created by the process of which process ID is
	01fff002, runs in the process of which process ID is 02fff002.
	-------------------------------------------------------------------------
	-------- Process ----------------- ProcID   AKY      BaseAddr
	-------- Thread -- State  ThrdID   CurProc  AKY      Cp Bp   CPU Time
	NK.EXE                             01fff002 00000001 02000000
	                   Blockd 01fff1be 02fff002 ffffffff 255 255 00:00:00.000
	-------------------------------------------------------------------------


	-------- Process ----------------- ProcID   AKY      BaseAddr
	-------- Thread -- State  ThrdID   CurProc  AKY      Cp Bp   CPU Time
	Process
		ProcID		Process ID(The unique value is allocated for the
				process.)
		AKY		Access key  It is available for the process of
				which bit is on.
				The process located at the top means the right
				edge bit.
		BaseAddr	The base address of the process
				If the process is active, 00???????? address is
				same.
				As an example of the above, if NK.EXE is active,
				02??????? and 00?????? means the same physical
				memory.

	Thread
		State		The state of the running thread
				Runing	in running
				Runabl	Waiting for CPU idle
				Blocked	 blocked state
				Sleepg	in sleep state
				Sl/Blk	Sleep or blocked stateH
		ThrdID		Thread ID(The unique value is allocated for the
				thread.)
		CurProc		The process where the thread is running
		AKY		Access key  It is available for the process of
				which bit is on.
				The process located at the top means the right
				edge bit.
		Cp		The current priority of the thread  The small
				value means the high priority
		Bp		The base priority of the thread  The small value
				means the high priority
				OS decides Cp using this value, the current
				waiting state, and so on.
		CPU Time	The time which used by the thread from the time
				when the process was created.
				(Note: this value is always 00:00:00.000)


6.Module
	The information of DLL

	-------- Module ------------------ hModule  InUSE    BaseAddr
	hModule		The module handle
	InUSE		The process which is using this module
			The process located at the top means the right edge bit.
	BaseAddr	The base address of the module

7.Window
	The information of Window

	The information of window is shown as descending order of Z order.
	The window located at the right side means the windows which has no parent
	or owner.
	The parent-child relationship is shown using the indent.
	+-- means the popup window.

	The following example indicates,
	MCMail is the windows which has no parent or owner.
	CMCButton is a child window of MCMail.
	CMCEditWind is a popup window of which owner is MCMail.
	FunctionWind is a child window of which parent is CMCEditWind.

	----------- Window --------------- hWnd     STYLE    EXSTYLE  ThrdID   ProcID
	MCMail                             00112858 00010000 08000000 81d51fb6 01e7f87a {  0,  0}-{240,320}
	   CMCButton                       001138d0 50000000 08000008 81d51fb6 01e7f87a {  0,  0}-{240,320}
	+--CMCEditWind                     00112c20 88000000 00000000 81d51fb6 01e7f87a {  0,  0}-{240,320}
	      FunctionWind                 001138d0 50000000 08000008 81d51fb6 01e7f87a {  0,  0}-{240,320}


	----------- Window --------------- hWnd     STYLE    EXSTYLE  ThrdID   ProcID
	Window		Window class name
	hWnd		Window handle
	STYLE		Window style  WS_VISIBLE, etc.
	EXSTYLE		Window expansion style  WS_EX_TOPMOST, etc.
	ThrdID		The ID of the thread which created the window
	ProcID		The ID of the process which created the window
	{}-{}		Window size  origin-endpoint



-----------------
About GetDbgInfo.txt
-----------------
The debug output is saved in the fixed 64KB memory.(This area will not be clear
by reset.)
GetDbgInfo.txt includes these data.

gi.exe save the above data in the file.
(The data will be added at the end of the file data.)



---- How to examine the exception ----
If the exceptions happens, the following information is outputted.

Exception 003 Thread=80f2a5f8 Proc=20d55426
AKY=00000401 PC=00011000 RA=0001102c BVA=00000000
Process 'Exception.exe'

Exception : Exception code(refer the CPU manual)
Thread    : Thread ID(refer the description of gi.txt)
Proc      : Process ID(refer the description of gi.txt)
AKY       : Access key(refer the description of gi.txt)
PC        : Program counter  The address where the exception happened
RA        : Return address  The return address of the function which caused the
	    exception
BVA       : The address which was tried to access in the case of the access
	    exception
Process   : Process name of PC

---- How to identify the function using the address ----
1. Create gi.txt when the exception happens or around it.
2. Identify the module using BaseAddr of the module and process.
	00??????
		EXE of the current process causes the exception.
		Identify EXE using ProcID(refer Proc in 'How to examine the
		exception').
		(There is no need if you can identify using the value of PC or
		the application where the exception happens is obvious.)

	In case of 01??????
		Identify DLL using BaseAddr of Module in gi.txt.

	In case of 02000000 and over
		Identify EXE using BaseAddr of Process.
		(There is no need if you can identify using the value of PC or
		the application where the exception happens is obvious.)

3. Identify the function using MAP file.
	The value which you take BaseAddr of the module from PC, RA, BVA becomes
	the offset address of the module.
	Compare the value, Rva+Base of MAP file, and the above offset address,
	then you can identify the function.
